import {
    FormItemType,
    CommonState
} from 'assets/js/Constant'

const columns = [{
        title: '编号',
        dataIndex: 'id',
        key: 'id',
        slots: {
            title: 'id',
            customRender: 'id'
        },
    },
    {
        title: "角色组",
        key: "ruleGroupId",
        slots: {
            customRender: "ruleGroupId"
        }
    },
    {
        title: "角色名称",
        key: "ruleName",
        dataIndex: 'ruleName',
    },
    {
        title: "角色描述",
        key: "ruleDesc",
        dataIndex: 'ruleDesc',
    },
    {
        title: "角色状态",
        key: "ruleStatus",
        dataIndex: 'ruleStatus',
        slots: {
            customRender: "ruleStatus"
        }
    },
    {
        title: "默认状态",
        key: "ruleIsDefault",
        dataIndex: 'ruleIsDefault',
        slots: {
            customRender: "ruleIsDefault"
        }
    },
    {
        title: '创建时间',
        dataIndex: 'createTime',
        key: 'createTime',
        slots: {
            customRender: 'createTime'
        }
    },
    {
        title: "操作",
        key: "action",
        slots: {
            customRender: "action"
        }
    }
];

const searchFormSchema = {
    options: {
        labelCol: 0,
        wrapperCol: 20,
        layout: 'inline',
    },
    groups: [{
        fields: [{
                type: FormItemType.SELECT,
                label: "角色组",
                name: "ruleGroupId",
                placeholder: "请选择角色组",
                props: {
                    label: 'ruleGroupName',
                    value: 'id'
                },
            },
            {
                type: FormItemType.SELECT,
                label: "角色状态",
                name: "ruleStatus",
                placeholder: "请选择角色状态搜索",
                props: {
                    label: "label",
                    value: "id"
                },
                sourceData: [{
                        id: 0,
                        label: "禁用"
                    },
                    {
                        id: 1,
                        label: "正常"
                    }
                ]
            }
        ]
    }]
};

const schema = {
    options: {
        labelCol: 4,
        wrapperCol: 20,
        layout: "vertical"
    },
    groups: [{
        fields: [{
                type: FormItemType.SELECT,
                label: "角色组",
                name: "ruleGroupId",
                placeholder: "请选择角色组",
                props: {
                    label: 'ruleGroupName',
                    value: 'id'
                },
                rules: [{
                    required: true,
                    message: "请选择角色组"
                }]
            },
            {
                type: FormItemType.INPUT,
                label: "角色名称",
                name: "ruleName",
                placeholder: "请输入角色名称",
                rules: [{
                    required: true,
                    message: "请输入角色名称"
                }]
            },
            {
                type: FormItemType.TEXTAREA,
                label: "角色描述",
                name: "ruleDesc",
                placeholder: "请输入角色描述"
            },
            {
                type: FormItemType.RADIO,
                label: "通用角色",
                name: "ruleIsCommon",
                placeholder: "请输入角色描述",
                props: {
                    label: "label",
                    value: "value"
                },
                sourceData: CommonState,
            }
        ]
    }]
};

export default {
    columns: columns,
    searchFormSchema: searchFormSchema,
    schema: schema
}